<template>
  <div class="purse_report">
    <div class="top_box">
      <dt-search ref="search" :xlBtn="4">
        <Button type="primary" @click="onExport" v-if="unlocking('0215020201')">导出</Button>
      </dt-search>
    </div>

    <dt-grid ref="table" :page="page" :onFetch="onFetch"></dt-grid>
  </div>
</template>

<script>
  import SearchOpt from '../opt/search.js'
  import column from '../opt/dataColumn.js'
  import purseMgr from './biz/index.js'
  export default {
    data() {
      return {
        page: {
          total: 0
        },
        parmas: {
          orgIds: [],
          housesId: null,
          housesName: null,
          userId: null
        },
        tabsVal: '5',
        needData: {}
      }
    },

    mounted() {
      this.$refs.search.init(this.$refs.table, new SearchOpt(), this.parmas)
      this.$refs.table.init(this, new column(this))
      this.$refs.table.fetch()
    },

    methods: {
      onFetch(info) {
        this.needData = {
          ...info,
          userId: Number(this.parmas.userId) || null
        }
        return purseMgr.getWithdrawWebList(this.needData).then((res) => {
          this.page.total = res.total
          return res.list
        })
      },
      onExport() {
        purseMgr.withdrawWebListExport(this.needData)
      }
    }
  }
</script>

<style lang="scss" scoped>
  .purse_report {
    padding: 24px;
  }
</style>
